package com.hzit.api.client;

import com.hzit.api.entity.Dept;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class DeptClientServiceFallbackFactoy implements FallbackFactory<DeptClientService> {
    @Override
    public DeptClientService create(Throwable throwable) {
        return new DeptClientService() {
            //客户端整体的工具
            @Override
            public boolean add(Dept dept) {

                return false;
            }

            @Override
            public Dept get(Integer id) {
                Dept dept = new Dept().setDeptno(501).setDname("没有找到：" + id + " 对应的信息...").setLoc("FallbackFactoy...");
                return dept;
            }

            @Override
            public List<Dept> list() {
                return null;
            }
        };
    }
}
